# coding=utf-8
"""
schedule handler
Author: kaspar
Date: 2022-04-06
"""

import schedule
import schedule
import time
from handler import handler_spider
from util.logger import Logger

def schedule_job():
    """
    schedule job
    1: daily
    2: weekly
    """
    schedule.every().day.at("00:31").do(handler_spider.WebCollector().my_spider_daily)
    schedule.every().wednesday.at("01:01").do(handler_spider.webCleaner(SINGLE_THREAD=False).my_spider_weekly)

    #schedule.every(1).minutes.do(handler_spider.WebCollector().my_spider_daily)
    # schedule.every(1).minutes.do(handler_spider.webCleaner(SINGLE_THREAD=False).my_spider_weekly)
    Logger.writelog('info', 'schedule start')
    while True:
        schedule.run_pending()
        time.sleep(10)